﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Server.Message
{
    class MsgRegister
    {
        readonly Dictionary<MsgType, List<Action<object>>> _handlers = new();

        public MsgRegister()
        {
            foreach (MsgType type in Enum.GetValues(typeof(MsgType)))
            {
                if (type == MsgType.None) continue;
                _handlers.Add(type, new());
            }
        }

        void Reg(MsgType type, Action<object> handler)
        {
            _handlers[type].Add(handler);
        }

        void Unreg(MsgType type, Action<object> handler)
        {
            Console.WriteLine(_handlers[type].Contains(handler));
        }

    }
}
